<template>
  <div>
    <div class="title">
      <h1>用量参数</h1>
    </div>
    <div class="content">
      <el-tabs v-model="activeName" tab-position="right"  @tab-click="handleClick">
        <el-tab-pane label="直接用量" name="first">直接用量</el-tab-pane>
        <el-tab-pane label="间接用量" name="second">间接用量</el-tab-pane>
      </el-tabs>
      <br>

      <direct-usage ref="directUsage" v-show="activeName=='first'"  @listenChild="getDirectUseage" @goBack="goBack"></direct-usage>
      <indirect-usage ref="indirectUsage" v-show="activeName=='second'" @listenChild="getIndirectUseage" @goBack="goBack"></indirect-usage>
    </div>

  </div>

</template>

<script>
  import DirectUsage from "./UsageParameters/DirectUsage";
  import IndirectUsage from "./UsageParameters/IndirectUsage";
  import BaseInformation from "./BaseInformation";
  export default {
    name: "UseageParameter",
    data(){
      return {
        activeName: 'first',
      }
    },
    methods:{
      handleClick(tab, event) {
        console.log(tab, event);
      },
      sendUseageParameter(){
        /*if(this.activeName=='first'){
          this.$refs.directUsage.sendDirectUsage();
        }
        else if(this.activeName=='second'){
          this.$refs.indirectUsage.sendIndirectUsage();
        }*/

      },
      getDirectUseage(){
        this.$emit('listenChild');
      },
      getIndirectUseage(){
        this.$emit('listenChild');
      },
      goBack(){
        this.$emit('goBack');
      }
    },

    components:{
      DirectUsage,
      IndirectUsage,

    }
  }
</script>

<style scoped lang="scss">
  .title{
    position:absolute;
    left:0px;
  }
  .content{
    position:absolute;
    top:100px;
    left:20%;
    right:25%;
  }
</style>
